#!/bin/bash

#==========================================================
# tail-errorlog
# File ID: 4647e9c2-5d46-11df-b57b-90e6ba3022ac
# tail -f på error_log til httpd(8).
#==========================================================

prefix=`date -u +"%Y/*%Y-%m-%dZ.error_log"`
if [ -e /sunba.mrk -o -e /svdbb.mrk ]; then
	tail -f /var/log/apache/error.log $*
elif [ -e /carmbb.mrk ]; then
	tail -f /var/log/apache2/$prefix $*
elif [ -e /grimme.mrk -o -e /recbb.mrk -o -e /toshbb.mrk -o -e /ba0614.mrk ]; then
	tail -f /var/log/httpd/error_log $*
elif [ -e /nett.mrk ]; then
	if [ "$1" = "sunbase" -o "$1" = "sunbase.org" ]; then
		shift
		tail -f /home/badata/wrt/sunbase/log/httpd/$prefix $*
	else
		tail -f /mnt/logs/httpd/$1/$prefix $*
		shift
	fi
elif [ -e /nett2.mrk ]; then
	tail -f \
	/home/badata/wrt/sunbase/musthave.sunbase.org/log/httpd/error_log \
	/home/badata/wrt/sunbase/snadder.sunbase.org/log/httpd/error_log \
	/home/badata/wrt/sunbase/tmp.sunbase.org/log/httpd/error_log \
	/var/log/apache/nett2.ba.no/*error_log \
	/var/log/apache/nett2.ba.no/$prefix $*
elif [ -e $HOME/.petronas.mrk ]; then
	tail -f /usr/local/apache/logs/error_log $*
else
	echo $0: Ukjent maskin, kan ikke skrive ut error_log >&2
	exit 1
fi
